package com.ybkj.o2o.zhuanche.service.impl;

import com.ybkj.o2o.zhuanche.entity.OrderMemo;
import com.ybkj.o2o.zhuanche.entity.OrderMemoCriteria;
import com.ybkj.o2o.zhuanche.mapper.BaseMapper;
import com.ybkj.o2o.zhuanche.mapper.OrderMemoMapper;
import com.ybkj.o2o.zhuanche.service.OrderMemoService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class DefaultOrderMemoService extends
    AbstractBaseService<OrderMemo, OrderMemoCriteria, Long> implements OrderMemoService {

  @Autowired
  private OrderMemoMapper orderMemoMapper;

  @Override
  public BaseMapper<OrderMemo, OrderMemoCriteria, Long> getMapper() {
    return orderMemoMapper;
  }

  @Override
  public int insert(OrderMemo orderMemo) {
    orderMemo.setCreated(new Date());
    orderMemo.setUpdated(new Date());
    return super.insert(orderMemo);
  }

  @Override
  public List<OrderMemo> findByOrderId(Long orderId) {
    return orderMemoMapper.findByOrderId(orderId);
  }

}
